added a routine to make the mean of generic fits files
fixed 2 little bugs in the do_mean_fits function