dict cleanup, write log file