fix crash when taking screenshot, fixes #193