added check for number of logfiles