Fixed crash in adapter