Fix a few edge cases