fixed sort buttons; added exception cases