I think I fixed this issue and submitted a new pull request:
Would appreciate someone else testing it. I only have one NAS to test it on, but it works for me.