fixed typo
adjusted dispatching to support IE < 9