Correctness-fixes in dealing with incorrect scripts