Update sa_lengths properly when replacing variable-size SA.

When updating a SA, the sa_lengths array is used to track the sizes
of all variable-sized SAs.  It had not been properly updated when
copying an already-existing variable-sized SA.  This didn't come up too
often because variable-sized SAs are relatively rare.

Fixes #1978.