Can't say I can think of something better. Like you, I don't like the solution but the API doesn't seem to allow any other way to do what you want.