added braces to if statement