Fixes context in query