Fix a bug in code that gave an error