Fix and improve dry run handling.