mds.c: added invert