fix npe in createFunction