CORE-562 Script error when saving a response

@sasmita514 can you open a jira ticket to clean this up a bit? I'm going to merge this PR.