misc bug fixes