Fixed screenshot NPE when error occured in before/after