cherry-pick from master, register controller fixes