Thanks for the patch!

Please change the name func here since it was defined in the top level function