Query split function had reversed arguments