Fixed bug and broken test due to day's earlier refactoring