Also check for maxNumberOfFiles if current numer is 0. Closes #2501.