Fixed up table sorting