Minor bug fixes and comments