Coverity fixes
Remove possible devision by zero (coverity fix)
Remove unused parent pointer (coverity fix)
Merge pull request #950 from cyclops1982/coverity

Coverity fixes