added sql indexes for m2m_history fields, fixed integrity error of fetching_reposts