Minor bug fixes and documentation improvement