misc fixes

a few more misc fixes for bugs spotted during a review