Fixed most issues with unit tests