code cleaning for screenshot with stub events