Misc bug fixes found during game engine testing.