added test for enqueuing packet. Fixed bugs revealed by test.