implement coverity suggetions in packethandeler, and a little code cleanup
Revert "Remove possible devision by zero (coverity fix)"

This reverts commit 4855a559d3d1ce7c74c2f922fc74a71889fc1987.
avoid division by 0, and make coverity happy, or not...
Merge pull request #1003 from mind04/coverity

coverity fixes