Fixed assertion errors when -ea is enabled.