converting back to matrices