Fixed sorting issue and fixed typo