Fix use of function betfore function definiton