in theory, fixed the EOF bug