i was suspecting the problem is with this functon only, but it turned out there was no probs..its my mistake only...