fix local memory use patch