fix for caculate sn