fix a bug about floating point issue