Fixed many NullReferenceExpections