implements #792