fixed bug where loadFile() would not work if called immediately from JS