changed isNaN checks to use angular native function