diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.H b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.H
index 6a5fa9e8c2940f99cfa2ccf07c6e1b441257bf5c..95ff5d327a5081b3544079573064a1c51a927b31 100644
--- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.H
+++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.H
@@ -123,8 +123,8 @@ public:
             {
                 return
                 (
-                    (a.first() == b.first()) && (a.second() == b.second())
-                 || (a.first() == b.second()) && (a.second() == b.first())
+                    ((a.first() == b.first()) && (a.second() == b.second()))
+                 || ((a.first() == b.second()) && (a.second() == b.first()))
                 );
             }
 
@@ -143,7 +143,7 @@ private:
 
     // Private data
 
-        //- Dictionary of phases 
+        //- Dictionary of phases
         PtrDictionary<phase> phases_;
 
         //- The phase chosen as reference, the one which is derived from
diff --git a/src/OpenFOAM/containers/Lists/PtrList/PtrList.C b/src/OpenFOAM/containers/Lists/PtrList/PtrList.C
index 2f4e617f057dd8b1ae07fc06415c9646bc241e38..c36656b33cec1a78af87861b34883c2924d2ba27 100644
--- a/src/OpenFOAM/containers/Lists/PtrList/PtrList.C
+++ b/src/OpenFOAM/containers/Lists/PtrList/PtrList.C
@@ -30,29 +30,24 @@ License
 #include "PtrListLoopM.H"
 #include "SLPtrList.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * * //
 
 template<class T>
-PtrList<T>::PtrList()
+Foam::PtrList<T>::PtrList()
 :
     ptrs_()
 {}
 
 
 template<class T>
-PtrList<T>::PtrList(const label s)
+Foam::PtrList<T>::PtrList(const label s)
 :
     ptrs_(s, reinterpret_cast<T*>(NULL))
 {}
 
 
 template<class T>
-PtrList<T>::PtrList(const PtrList<T>& a)
+Foam::PtrList<T>::PtrList(const PtrList<T>& a)
 :
     ptrs_(a.size())
 {
@@ -65,7 +60,7 @@ PtrList<T>::PtrList(const PtrList<T>& a)
 
 template<class T>
 template<class CloneArg>
-PtrList<T>::PtrList(const PtrList<T>& a, const CloneArg& cloneArg)
+Foam::PtrList<T>::PtrList(const PtrList<T>& a, const CloneArg& cloneArg)
 :
     ptrs_(a.size())
 {
@@ -77,7 +72,7 @@ PtrList<T>::PtrList(const PtrList<T>& a, const CloneArg& cloneArg)
 
 
 template<class T>
-PtrList<T>::PtrList(PtrList<T>& a, bool reUse)
+Foam::PtrList<T>::PtrList(PtrList<T>& a, bool reUse)
 :
     ptrs_(a.size())
 {
@@ -101,7 +96,7 @@ PtrList<T>::PtrList(PtrList<T>& a, bool reUse)
 
 
 template<class T>
-PtrList<T>::PtrList(const SLPtrList<T>& sll)
+Foam::PtrList<T>::PtrList(const SLPtrList<T>& sll)
 :
     ptrs_(sll.size())
 {
@@ -124,7 +119,7 @@ PtrList<T>::PtrList(const SLPtrList<T>& sll)
 // * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * * //
 
 template<class T>
-PtrList<T>::~PtrList()
+Foam::PtrList<T>::~PtrList()
 {
     forAll(*this, i)
     {
@@ -139,8 +134,15 @@ PtrList<T>::~PtrList()
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 template<class T>
-void PtrList<T>::setSize(const label newSize)
+void Foam::PtrList<T>::setSize(const label newSize)
 {
+    if (newSize < 0)
+    {
+        FatalErrorIn("PtrList<T>::setSize(const label)")
+            << "bad set size " << newSize
+            << abort(FatalError);
+    }
+
     label oldSize = size();
 
     if (newSize == 0)
@@ -160,7 +162,7 @@ void PtrList<T>::setSize(const label newSize)
 
         ptrs_.setSize(newSize);
     }
-    else if (newSize > oldSize)
+    else // newSize > oldSize
     {
         ptrs_.setSize(newSize);
 
@@ -174,7 +176,7 @@ void PtrList<T>::setSize(const label newSize)
 
 
 template<class T>
-void PtrList<T>::clear()
+void Foam::PtrList<T>::clear()
 {
     forAll(*this, i)
     {
@@ -189,7 +191,7 @@ void PtrList<T>::clear()
 
 
 template<class T>
-void PtrList<T>::transfer(PtrList<T>& a)
+void Foam::PtrList<T>::transfer(PtrList<T>& a)
 {
     clear();
     ptrs_.transfer(a.ptrs_);
@@ -197,7 +199,7 @@ void PtrList<T>::transfer(PtrList<T>& a)
 
 
 template<class T>
-void PtrList<T>::reorder(const UList<label>& oldToNew)
+void Foam::PtrList<T>::reorder(const UList<label>& oldToNew)
 {
     if (oldToNew.size() != size())
     {
@@ -247,7 +249,7 @@ void PtrList<T>::reorder(const UList<label>& oldToNew)
 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
 
 template<class T>
-PtrList<T>& PtrList<T>::operator=(const PtrList<T>& a)
+Foam::PtrList<T>& Foam::PtrList<T>::operator=(const PtrList<T>& a)
 {
     if (this == &a)
     {
@@ -284,10 +286,6 @@ PtrList<T>& PtrList<T>::operator=(const PtrList<T>& a)
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 #include "PtrListIO.C"
diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C
index 547ac4cfda55c96a1535ca7c45dd581d1874733e..35b47ffd106ef9dba9a2db0c5b0718af54a3f112 100644
--- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C
+++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C
@@ -85,7 +85,7 @@ void Foam::fvMeshDistribute::addPatchFields(const word& patchFieldType)
             );
 
         label sz = bfld.size();
-        bfld.setSize(sz+1);
+        bfld.setSize(sz + 1);
         bfld.set
         (
             sz,
@@ -124,10 +124,8 @@ void Foam::fvMeshDistribute::deleteTrailingPatchFields()
                 fld.boundaryField()
             );
 
-        label sz = bfld.size();
-
         // Shrink patchFields
-        bfld.setSize(sz-1);
+        bfld.setSize(bfld.size() - 1);
     }
 }
 
diff --git a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.H b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.H
index 169a7dfb08565e5095be2254087a6e8505bbedb6..a818bad2998c1c6beb2afb38f921e7dc96b3bb71 100644
--- a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.H
+++ b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.H
@@ -196,7 +196,7 @@ public:
         const triSurfaceMeshes& surfaces() const;
 
         //- Mode of projection/following
-        const followMode projectMode() const
+        followMode projectMode() const
         {
             return projectMode_;
         }