fix register and redirect