Fix to screenshot code so it won't crash when nothing has focus.(which is what I think was happening)