In reply to cgales:
I have updated the details and problem description. Do you see anything unusual in the code ?