Fix crasher in some cases.