fix problem when cm / cmi is invoked in a symlinked folder using e.g. --directory