added check_status function