fixed instanceof operator and tested in IE < 11 too