i actually didnt restart the machine but logged it off. the problem was, i was doing it through VNC. i logged off the machine which didnt kill the session with my machine.
after it logged on, i again started using it from my machine and this amazing this happened. when i hit echo command from my machine, result differ from that of when i hit this command from that machine.
now the server works fine when i restarted the machine even on the VNC :)
may be this because i am using windows on my machine.
No it is probably because the contents in '/etc/profile' are not processed until you start a new session - you probably had a combination of new and old sessions running which was why you were getting wierd results.