Fix code (currently failing unit tests)