Minor bug fixes

Hi Andrew,

Here are the minor bug fixes again without the merge commits. 

Cheers,

Tom