Added CachingStreamFactory, fixed execution bug