Fix NaN issue when using outside iframe