minor change in sd algo