Progress on #769, fixed #792