Fixed attribute name assignment bug, and improved error message handling.