Fixed typo and added debugging.
Only handle packet if there is one.