added nanmean and nanvar functions