Fix PHP notice for checking non-dirty attributes

closes #210
closes #233