move isinst to a header file