fixed issue #14, patch from Martin Mahner