If you're talking about Arceus, Deerling/Sawsbuck, Genesect, Giratina or Shaymin, then that's not a bug. They have scripts which automatically determine their forms (getForm), which can't be overridden. The wiki says this, if you care to read it.
Oh!, sorry about that. I did not know.