In this paper, we study the unconditional security of the so-called measurement device independent quantum key distribution (MDIQKD) with the basis-dependent flaw in the context of phase encoding schemes. We propose two schemes for the phase encoding, the first one employs a phase locking technique with the use of non-phase-randomized coherent pulses, and the second one uses conversion of standard BB84 phase encoding pulses into polarization modes. We prove the unconditional security of these schemes and we also simulate the key generation rate based on simple device models that accommodate imperfections. Our simulation results show the feasibility of these schemes with current technologies and highlight the importance of the state preparation with good fidelity between the density matrices in the two bases. Since the basis-dependent flaw is a problem not only for MDIQKD but also for standard QKD, our work highlights the importance of an accurate signal source in practical QKD systems. Note: We include the erratum of this paper in Appendix C. The correction does not affect the validity of the main conclusions reported in the paper, which is the importance of the state preparation in MDIQKD and the fact that our schemes can generate the key with the practical channel mode that we have assumed.