This fixes #4757, fixes #4758, and fixes new fuzzbugs that are probably coming after we merged #4667.