Still having issues writing to a file