bug fixes and doc update