With no full program to examine, it's hard to say what's going on. Would it be possible to create a small sample program that shows the same issue and post that here?
Is there any pattern to when it does and doesn't capture the output (time of day, etc.)?