add conditional to string to number function