Changed type check to isinstance check