Adding tests and fixing a bug with cloning

- Closes #2040
- Add basic testing