Corrected IF Statement End

Sorry just realised if statement was incorrect in my last push - corrected here.
Merge pull request #2126 from daygle/patch-5

Corrected IF Statement End