Bugfix: script error when sorting widgets

Story: https://reciprocitylabs.atlassian.net/browse/CORE-227