Fix query context loosing