modified the way to take the screensshot