Need to change some conditions for shifting the origin

Need to change some conditions for shifting the origin.