Fix a couple of bugs for how this works.