Fix a number of errors