register with ref added, working