register function working