Fixed sort issue
Fixed some tests