fixed how the var last is updated in Sarray