bug fixes and documentation