Small bug fixes.
Refactoring kohelpers.