Fixed packet handler (works client & server side)