Revert "Revert "memory leak solved (probably)""

This reverts commit 05ddf8a3f177fcd32137e7f93dbf9039104cdd28.