Last round of fixes for working with mapped files

This is necessary to make the required directory tests pass.