[FIX] TypeError exception in parse_values() and some fixes in write_values()