Fixed error in query