fixing isinstance check