fixed double-free bug