Always, ALWAYS, enclose all blocks in curly braces, even one line blocks. This includes all if blocks and else blocks.

Doing this will solve your problem.