various bug fixes and doc updates