Fixed problem with getattr. Wasn't handling errors correctly.