fixed sorting (accepting strings, too)