noticed a memory leak, patched it up