I am new in programming addons and sorry for my english (I am german).
I am writing now an addon for alternative unit frames. I know there are some real good unit frames addons but I write this for me to learn and understand.
I started with the player frame. Everything works well but the start.
When you start a new game it is looking like this:
After /reload or the event UNIT_HEALTH/UNIT_MANA it works fine:
I think it is just a simple beginner mistake and hope you know what is wrong.
I haven't looked at your code, but my guess would be that you're initializing things too early, calling UnitHealth/UnitMana/etc before that information is actually available to the client, and not checking that your return values are valid before attempting to perform arithmetic on them. If that's the case, you should hold off trying to update your text until IsLoggedIn() returns true... which happens once PLAYER_LOGIN has fired.