Fix some corner cases.