Fixed some refactoring bugs.
Not sure if this is the intended behavior, but it fixes the test.