Fixes a few edge cases.