misc bug fixes and documentation improvements