Fixed isNaN issue with Safari