fixed substitute register function