Small bug fixes.
Bug fixes and minor code cleanup.