Fixed bugs. Added debug file in tools.