Fix selection and viewport when cloning

Fixes #37.