added number.isnan polyfill; other minor fixes