change end condition