always use uint16 for array length
updates for logging and figuring out the resetting problem