Fixed bugs in related tools