You should really not expect $v1 to be available outside of an if statement-- I think you're using the identifier outside of its intended purpose, and the behaviour is undefined.
- argv[0] on EFnet #mIRC - "Life is a pointer to an integer without a cast"