use hash["class"] instead of hash.class to make IE<10 happy
more robust object checking