fixed a bug on the screenshot function