Fixes rare crash mentioned in #105.