Added index out of bounds handling to packet