Variable type is determined by the name
Bug fix: making sure valid query is built