Fixed issue when sorting by id column.