Fix a few bugs related to alias removal