changed some error in sort