finally understand getattr and worked out my errors