Fix file output for dictionaries replace_value function