fixed freeing error in manual version