fix nullpointer if query not exists