Well, yeah, the answer is already in your question. You're trying to bring a sprite to front which is at the front already and you're trying to bring a sprite to back which is at the back already. Of course SetSpriteZPos() fails then... it can't do anything that's already been done.