Fixes for hasClass (thanks @davethegr8)