make the method 'instanceof' fast
add tests for instanceof
fix a cpplint error