fixed small error in writeProb