fixed unclosed if statement