Fix a bug which corrupts memory when getting a file from Index