Fix bug with instanceof