better handling of corner cases