Coverity fixes

A few issues identified by coverity.
xoft, you really shouldn't try coding with a small screen whilst on holiday again :P