Fix Fortran regression with variables in nested functions