hasattr replaced with getattr