It looks like that issue is solved. There’s no reason for the code in that answer to return a string whenever it’s being casted as an integer which means something else is causing the string casting.
You would need to show your full code for us to be of any assistance.