Have you tried printing the values that are being compared ro see if they are what you expect them to be ?