untested fix for #46 slightly cleaned up