Hi,
please use still the version 4.0.24 but install try the attached module version.
I have now checked your error message.
However, I cannot reproduce it. Because even if I have not yet created any downloads, the result of the database query is (as expected) an array() and the error does not occur. In your case, however, the value seems to be an integer. And only then does the error occur.
I can't exactly narrow down the reason for this unexpected return value at the moment.
However, to avoid the error in the future, I have changed the lines in question.
Edit:
Module updated with the right version!