Do not iterate with dir when we only need to check for the existance of a member
Added missing import
Fixed typo in comment