changed type check logic for schema