Fix nan-bug;