return 0 on fread on invalid stream
fix file preloading in workers and add test