Jessie fix

These two changes are needed to build on Jessie (I had different fixes in my branch - but these are better); so can they be merged while we're waiting for the Trusty branch?