must check function type first