implements #781