Fix bugs introduced in the last commit.
1) properly register "ready" and "error" listeners.
2) update chart type if it changes
Merge pull request #2 from nathankopp/gh-pages

Fix bugs introduced in the previous commit.