Master equations for two qubits coupled via a nonlinear mode