apply old fixes to new pmtk in github