Fixed bug introduced in patient deep cloning code; added tests