Fix tests involving query expressions