Registration to use ROI in image and some bugfixes