Now I really don't understand what's going on. Trying the exact same thing (putting the code of the 2nd example in the palace) gives me this result instead:
Which is incorrect and looks different than yours (yours is correct).
Sorry but i forgot to mention that my screenshot comes from a modfied DLL. I just wanted to be sure if i changed it in the right way.