Mitigate error in trimming screenshot