fix charset scoring and add tests