Fixed crash issue by null reference