In cases like this it’s generally a good idea to post your source code. It might be a typo or logic error.