Fix bug with counting of sheets