Fixed a freed pointer that was pointing to random stuff. Thanks omajid.