Here are Fortran codes used throughout some of my courses.
Value function iteration: link -- The provenance on this code is iffy--I believe it is original or at least heavily modified by me, but I couldn't find my original version. This is copied out an email I sent as we all collaborated. Solves the issue, however. Enjoy.