fixed double free error