added {} on if statement line 375