Fixed bug with getattr function