Fix comparison grouping for Functions

TODO: write a test