Fix various issues found whilst building