Pulled changes from master for copy_status_to_sample script