http://sscce.org/
Your random lines taken from whatever code you have don't tell us the whole story.
If you've got a <20 line test program demonstrating your issue, then post it "as is".
It removes ALL of the guessing on our part, and will get you answers quicker.