Have you tried running your program through your debugger. The debugger should be able to pinpoint where the problem is being detected. Without the smallest possible complete program that illustrates...