now file reading uses correct length