Fixes to iprove compile time