Fix random crash that can happen on open.