fix bugs
revert because memory management