small fixes to a few bugs