Revert "fixed more memory leaks"

This reverts commit 6e61e691dc11da4064f30411df5209f45a408211.