Various fixes - This is a very bad commit message.