U.S. court rules for government over NSA metadata collection program