fixed unclosed if/endif