added basic error checking to check that len(pkt) is always at a proper value so program doesnt crash.