How to avoid the free-rider problem in teams