fix: automatic optimization (nan)