fix overuse of memory