Some fixes to