fixed null reference errors