implements #982