Fix a NaN problem

Something fishy is going on with the association, it needs to be investigated
further. After this patch I am not getting any NaN.
Merge pull request #17 from certik/nan_fix

Fix a NaN problem