Fix #127: instace of bug, refactor instanceof operator