fixing bug in check pointing