Bug correction for Class::method() in a if condition