CORE-562 Script error when saving a response

@sasmita514 I see you were the one who added this code, can you explain why this is necessary?