moved flagstat after spatial_filter