error fix 1

rare error if last columns of A*S are empty