Fix some bugs in file system code.