patched critical memory leak