Fix a couple of pretty obvious bugs I'd introduced