multiple files: fixed error checking length