Fixed some null reference errors (was causing huge lag too)