Fix std::length_error when no_proxy is used

This is regression introduced in 8cada497.