Add debug functionality
Convert prev_index to uint before sending