changes in main to free correctly2