More misc bug fixes