better handling for async file loading