correcting some query