moved if statement execution code inside brackets
Merge pull request #1653 from darkstar21/master

Moved if statement execution code inside brackets