Hi,
I think that this is a typo.
At function circle_same the second isnan test is wrong.
Attached fix patch.
regards,Ranier Vilela