Fixed a major memory issue