Fix AttributeError at line 1102