Corrected bug with respect to setting endpoint