Corrected errors found by unit tests.