Various minor fixes to prevent stuff breaking