Fixing bug where calling to_sql will destroy the sql binds (query values)