added function to load from stream