minor fixes, untested