Fix js strict-mode error: avoid prohibits function statements not at the top level of a script or function.