fix bugs, especially regarding metafun format

Many nice features of metafun are still missing here.