Another attempt at fixing memory issue, #3