Hotfix/memdietbugfix

fixed a serious bug in the previous merge.