Fixed the last broken (reverted) commit by finding the actual bug.