Memory usage fix