Fixed reading EOF from scripts