Fix a couple of small optimiser-found bugs.