Fixed code so that all unit tests run