fixed bug in apply line (L11) to return a matrix (L12) instead of a list