Fixed uncaught exception crashing during sort.
Fixed sorting process failing.

The UI-related code hadn't been updated to reflect recent changes. Fixes
#341.