Fixed bug, all tests passing