Fix compile error if aggregate with different method signatures is used in optimize{} block