Fix a couple of code mistakes