Fix bugs, add statistics and qie cut output