added missing {} on if statement