new mesif code, some more fixes