Fix incorrectly creation of screenshots (fixes #845)