[BUG #8530] Added checks for null and undefined to fix getClass on IE8