Bugfixes in metapatterns and math, add markers