misc bug and typo fixes