updating for getlogical and foldmatrix