Use isinstance to validation

Fix validating unicode strings