add support for later defining a previously undefined function, and accompanying test