fix register function