Fixed error in stack management of user defined functions.