Some fixes to startup code