Remove useless code and fix firts loading of predef query