Fix chebfun merge

Closes #990.