restore changes from c981f63d

lost during pull request #4 to f9a90829
(cherry picked from commit adcddeb260ebb1c01b4215be9b8da2f2b7807203)