Fix issue #78 by applying patch proposedin issue #87