Fixed a bug and updated a test to make all the tests pass.