Fixed crash in object creation