Stabilization of resistive internal kink modes in tokamaks with non-circular cross-section