Some fixes to main