Bugfixes on dictionary building.