fixed bugs in missing residue builder