use std to remove outliers.
 update several bugs