modifiy condition to endData