Updated `classOf` to check for undefined value first for older versions of ie.