safe type assertion