fix empty array case
fix incorrect number handling