Adjusted Q.typeOf to work with IE8