FILEIO: fix read_gulp and write_gulp.

Fixes commit 2a06df01ffb33395426432556fcd43f4545d2a7f.