fix GEM_HOME for builds outside Vagrant VM
improved query manager