Fix "Don't make functions in loop" error.