sorry.
it was a matter of timing, as the 0.25 second delay wasn't enough for the turtle to detect that the falling sand or gravel turned from an entity to a block (i think)
that still wouldn't explain why it ran off, but it works with a 0.5 sec sleep.