added some handling to epg inserting