better free() method