fixed a bug in search ordering