fix searching for "if" if "endif" already closed an if-statement