simplify hasClass method