Bugfix

Sorting did not work properly. Drag/drop was enabled causes error. Also
added a check to check data