resolving sorting issue