fixed crash when sorting a vector