fixed copy-paste bug (double-free)