made inner function static in ai_nim