Fix a few remaining bugs