Misc bug fixes 2