Bug-fix in autosort