Fixed bug with sorting empty array.