Judges restore rules on safe abortion