fixed parsing of end statements in scripts with IDs matching keywords