fixes issue #81 and closes #99

thank's for @MultiCoreNop, who open a PR with the fix