Fixed most of null reference exceptions