Fix crash in test