Free memory
Fix regression caused by #1771, fix #1770 as well