Fixed access violation issue in script parse function