EU states agree on asylum compromise