Fix exception in the teams RPC (#1836)