Fix loader and query loop