diff --git a/include/class.thread.php b/include/class.thread.php
index e90fc095f92f4d718b0626beef1d60749c9ff485..587e01349f24d1dec2308f09826da84c86fa5f5f 100644
--- a/include/class.thread.php
+++ b/include/class.thread.php
@@ -934,8 +934,8 @@ class ThreadEntry extends VerySimpleModel {
             //We have a valid ticket and user
             if ($ticket->getUserId() == $user->getId() //owner
                     ||  ($c = Collaborator::lookup( // check if collaborator
-                            array('userId' => $user->getId(),
-                                  'ticketId' => $ticket->getId())))) {
+                            array('user_id' => $user->getId(),
+                                  'thread_id' => $ticket->getThreadId())))) {
 
                 $mailinfo['userId'] = $user->getId();
                 return $ticket->getLastMessage();
diff --git a/include/class.ticket.php b/include/class.ticket.php
index 5df9f9a82de862e52128542f5907323e852ee41b..e78336dab3aa633ec30650704271e74f814919d9 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -396,8 +396,8 @@ implements RestrictedAccess, Threadable {
 
         // 2) Query the database to check for expanded access...
         if (Collaborator::lookup(array(
-                        'userId' => $user->getId(),
-                        'ticketId' => $this->getId())))
+                        'user_id' => $user->getId(),
+                        'thread_id' => $this->getThreadId())))
             return true;
 
         return false;
@@ -1543,7 +1543,8 @@ implements RestrictedAccess, Threadable {
                     User::lookup($message->getUserId()), $this);
         else
             $user = Collaborator::lookup(array(
-                    'userId'=>$message->getUserId(), 'ticketId'=>$this->getId()));
+                    'user_id' => $message->getUserId(),
+                    'thread_id' => $this->getThreadId()));
 
         /**********   double check auto-response  ************/
         if (!$user)
@@ -1990,8 +1991,9 @@ implements RestrictedAccess, Threadable {
                 $thisstaff->getName(), $user->getName());
 
         //Remove the new owner from list of collaborators
-        $c = Collaborator::lookup(array('userId' => $user->getId(),
-                    'ticketId' => $this->getId()));
+        $c = Collaborator::lookup(array(
+                    'user_id' => $user->getId(),
+                    'thread_id' => $this->getThreadId()));
         if ($c && $c->remove())
             $note.= ' '._S('(removed as collaborator)');
 
diff --git a/include/staff/templates/dynamic-form-simple.tmpl.php b/include/staff/templates/dynamic-form-simple.tmpl.php
index 1c31b8fed135211e77fe932922e44f989cabaeda..30b43c6b9072b477f21ed2c8c724ddaaa7eef2a0 100644
--- a/include/staff/templates/dynamic-form-simple.tmpl.php
+++ b/include/staff/templates/dynamic-form-simple.tmpl.php
@@ -1,4 +1,4 @@
-        <?php
+<?php
         echo $form->getMedia();
         foreach ($form->getFields() as $name=>$f) { ?>
             <div class="flush-left custom-field" id="field<?php echo $f->getWidget()->id;
@@ -28,5 +28,6 @@
                 <div class="error"><?php echo $e; ?></div>
             <?php } ?>
             </div>
-        <?php }
-        ?>
+        <?php
+        }
+?>
diff --git a/include/staff/templates/list-items.tmpl.php b/include/staff/templates/list-items.tmpl.php
index e57a8bf09fd5265c675447728c2aeb880e45e074..c1df5299910bdd514d015b4f163df6c089fa76bc 100644
--- a/include/staff/templates/list-items.tmpl.php
+++ b/include/staff/templates/list-items.tmpl.php
@@ -1,4 +1,5 @@
-    <?php if ($list) {
+<?php
+    if ($list) {
         $page = ($_GET['p'] && is_numeric($_GET['p'])) ? $_GET['p'] : 1;
         $count = $list->getNumItems();
         $pageNav = new Pagenate($count, $page, PAGE_LIMIT);
@@ -124,4 +125,3 @@ if ($list) {
     <div><?php echo __('Page').':'.$pageNav->getPageLinks('items', $pjax_container); ?></div>
 <?php } ?>
 </div>
-