fixed bug in sorting, can't pad with infinities