Several fixes for filesystem related stuff.