Fix some queries