enchanced the hasClass function