fixed error in find_best_action function