bugfixes and applied ROI to foreground mask