fixed bug in the way sdev is handled