Fix #165, EOFException while sorting data