use isinstance instead of type