fixed error computing s