fix to #44 and cleanup

Fix for #44.