( Fixed the problemCollapse )Turns out it was a stupid issue with the type of the variable. One of the annoying bits when working with a weakly-typed language, I guess. I fixed it by multiplying role by 1, forcing javascript to interpret it as a number.