Issue #231 query fix in controllers