Fix build_query when the value is an Array or a Hash