Fixed crash when defer is used in init function.