Added some changes to capture_screenshot.
Merge.