fixed reverse sorting functionality