(GH-489) Functions inside function issue solved