BUG: Fixed issue where before save was not being called

BUG: Fixed JavaScript error undefined variable when calling sortWidgets