sorting now working for older PHP versions