Handle attribute assignments to self correctly

* Closes #149