Added test coverage, uncovered a bug