Fixed problem with sort defaults and lack of error-checking