Fix Memory problems