Proposed patch to fix this crash.