fixes reading EOF into array