Polish the Fortran code

Just a few fixes here and there that I noticed. See the commit logs for details.