Reducing cavity-pulling shift in Ramsey-operated compact clocks