modify check for self in class context