Fixing some errors with unit tests