Correctly compare strings
Free resources in cat