Fixing a few bugs.f