better handling of edge cases for complements