Added a check for null sd.