Fix bug increasing memory