fixed check_correctness method