changed length to remainingBufferLength in FileSystem.java