update Register function