fixed NullReferenceException on end trigger