Some minor bug fixes and documentation update