fixed bug where function comparison was not done correctly