Fixed some instanceOf bugs.