Wallpaper does not change on every desktops

I looked in to this and basically it will only work if you are on the first Space. Unfortunately, Apple doesn't make any of the Spaces API public, and it looks like this is some sort of relation to that. I also found in my testing that even the System Preferences gets somewhat confused about desktop images and spaces (showing a picture that I configured as a desktop for a space I had deleted).