hasClass() fixes, added test