Thanks! Was able to fix these.
Kind of weird this went unreported for so long. Was able to fix stuff on last patch, but there's some other serious bugs here too. Really old code.
Edit: ahh, figured it out. The game had a weird coding convention where it passed around all a functions arguments...