Fix broken isClass check and renamed variable for clarity