@laptophead – were you able to resolve this?
It is hard to test this or give feedback with only a code fragment.