several bug fixes, hopefully not new bugs