Fixed a segmentation fault on plugin unload.
Made the "free x" debug messages only appear if that free actually occured.