Minor patches, mostly dealing with ASan

e78ae1f and f8562ee change a bit of logic.