more cleanup and fix for issue #8