Fixed has_attr to hasattr