Hello, I was trying to make a program for turtle to wait for fuel when the fuel is low, but the program that I made checked the fuel, tried to refuel (even though the slot didn't have any fuel) and continue the program. Is there any way to make turtle to wait for the fuel and resume the program when he gets fuel?

Also, I have problem with my program which turtle digs the area I asked. The problem is that when I ask turtle to dig 2 deep and 2x2 square, turtle would dig the first 2 blocks properly, but will go to the next and break the block in front of it, but won't dig the block down and come back. I don't want turtle to break the next block, but I couldn't find a way to fix it. Could anyone please help

The script for that part is:
function line()
  for aa = 1, tArgs[2] do
	down()
	up()
	forward()
end
end

function down()
for i = 1, tArgs[1] do
  while not turtle.down()
	do turtle.digDown()
end
end
end

function up()
for i = 1, tArgs[1] do
  while not turtle.up()
	do turtle.digUp()
end
end
end

function forward()
  while not turtle.forward()
	do turtle.dig()
end
end