replace bad with code