Some fixes to stream loading