I'm not sure why you are so angry about this... lets take a deep breath.
I'm clear on your explanation of the issue, but to be 100% honest, I cant tell why your custom code snippet is acting the way you describe without seeing the entire code in context.
it could be any number of things, if all i have to go on is a code snippet though, all i can do is take a wild stab in the dark.
send a copy of the pages involved so I see all of the code to get a better idea of what is going on, If i can see the code, I probably tell why it is acting the way it is acting.