fix code unprepared for nil script_level