def _insert_dummy_zmat(self, exception, inplace=False):
        """Works INPLACE"""
        def insert_row(df, pos, key):
            if pos < len(df):
                middle = df.iloc[pos:(pos + 1)]
                middle.index = [key]
                start, end = df.iloc[:pos], df.iloc[pos:]
                return pd.concat([start, middle, end])
            elif pos == len(df):
                start = df.copy()
                start.loc[key] = start.iloc[-1]
                return start

        def raise_warning(i, dummy_d):
            give_message = ('For the dihedral reference of atom {i} the '
                            'dummy atom {dummy_d} was inserted').format
            warnings.warn(give_message(i=i, dummy_d=dummy_d), UserWarning)

        def insert_dummy(zmat, i, dummy_cart, dummy_d):
            """Works INPLACE on self._frame"""
            cols = ['b', 'a', 'd']
            actual_d = zmat.loc[i, 'd']
            zframe = insert_row(zmat, zmat.index.get_loc(i), dummy_d)
            zframe.loc[i, 'd'] = dummy_d
            zframe.loc[dummy_d, 'atom'] = 'X'
            zframe.loc[dummy_d, cols] = zmat.loc[actual_d, cols]
            zmat_values = dummy_cart._calculate_zmat_values(
                [dummy_d] + list(zmat.loc[actual_d, cols]))[0]
            zframe.loc[dummy_d, ['bond', 'angle', 'dihedral']] = zmat_values

            zmat._frame = zframe
            zmat._metadata['has_dummies'][i] = {'dummy_d': dummy_d,
                                                'actual_d': actual_d}
            raise_warning(i, dummy_d)

        zmat = self if inplace else self.copy()

        if exception.index in zmat._metadata['has_dummies']:
            zmat._remove_dummies(to_remove=[exception.index], inplace=True)
        else:
            insert_dummy(zmat, exception.index,
                         *zmat._insert_dummy_cart(exception))

        try:
            zmat._metadata['last_valid_cartesian'] = zmat.get_cartesian()
        except InvalidReference as e:
            zmat._insert_dummy_zmat(e, inplace=True)

        if not inplace:
            return zmat