Added hasattr test