fixed some null related problems\