improve error handling for incoming packet processing