Fix issues in scoped_resource.h uncovered through testing.  A=A cases and operator= issues.