Stable rc

Fix various crashes in the web interface. Fix capture-replace and most of the numbering inconsistencies.
Wow, good catch, that one is pretty embarassing... I refactored the flow of the method a while ago and this is a remnant from an earlier version were the retaken pages were added to self.pages before the old ones were removed.