Misc bug fixes during testing