More fixes for edge cases.