bugfix/mmexternal: memory leak