use endpos if available and different from startpos