Fixed an improper query