fix a few edge cases