Error between versions - Override

Hello, I have a script that works perfectly in the 2019 version but it is pointing out an error in the 2020 version. I had tested it before and it was working, I’m not sure what may have changed.
It selects the slabs and beams that have a offset from level and applies a override. Could anyone tell me why this error started to appear now?

image Hatch.dyn (54.6 KB)