adding better exception handling for packets