adding fixes from PR #117 to source

Clsing #117 in favor of adding fixes to source and not to the debug file