Unless you post the code that you are trying to use, how can we suggest how to address the problem?