handle various corner cases