added flush, removed print_packet