Fix dimensions setup for return matrix creation.