fixed spaces issue in querying