Bug in helpers.replace_illegal_chars