avoid going to end