Add braces to conditionals to fix some errors.

I checked the whole code and there are 3 errors of this kind, so I fixed all of them in the same pull request. I've tried not to put braces wherever possible to avoid changing the original style of the code.