fixing initial query sort