Fix for bug 569 (free memory)