fix error in functions.sql