resolved a bug in query