Fix crash bug on render