better handling of some corner cases