pulling forward changes in #398 4788e8e3878ed2308946aa7e641f6af3c8247825