fixed screenshot function