Fix bug: MAD should be computed on all frames