Add a check clause to avoid resource cloning (issue #172)

- And add units tests to verify that it works as expected
Merge pull request #202 from sinfomicien/fix-resource-cloning-with-check

Add a check clause to avoid resource cloning (closes #172)