Add query expression checking