added case for empty array with leading zeros