fix issue #22 (thanks trgibbons)