added fg & bg image retrieval to streaming middleware