bug fix calculation sd