Consistent couplings between fields with a gauge freedom and deformations of the master equation