fix NaN for chrome 31 and firefox