updated check_output