Coverity fixes 20131016

Two issues remain: #179 & #180

This could be merged without them.