Bug fix, reworked hasClass function