Fix bug: creating funcrefs before defining functions in function_map