Fixed function defined in another function problem.