fix issues related to multipage: remove selection rectangles, remove previous image/page, check if page exists in pages