fixed null reference bug