Potential fix for crash in #38, not sure of cause