I was looking through the code, and I think that line is the error. The code is checking for weapons there instead of items, I think.
Edit: That was indeed the issue, once I changed it to $dataItems, it started working as expected.
It was patched in v3.2