fixed double free bug