Fix compiler error with dynamic_select, and fix error with empty query result