Fixing bugs with affinity score