fixed a bug. unit tests pass but benchmark fails