Fix crash in handlers