Fix use of functions in the query builder

JAVA-44 #fixes