fixed missing braces on if statement