Caching weights in PatchMatch. Bugfix.