Some changes to pagecapture and capture_screenshot
merge