use cli to lock datastructures shared by interrupts and elsewhere
fix some scheduler and timer issues