Revert "More freeing memory (needs to be verified)"

This reverts commit 2ebae487f0c8e147052f948596d67241532f5f18.