Fixed usage after free()