Fix bug in operator resolution

lets do this for functions also if possible