Implemented accurate safety for tube segment

(cherry picked from commit 7aa60007e287875055763ee5b21fb7f9004d72d5)