Add except case for AttributeError