Minor bug fixes.
Add document.