One thing that made trains safer were brakes, which helped them to stop so that they would not crash into trees and things.
On movies, have you ever noticed that sometimes there's trains chugging along and then you see that the railroad is broken? Well, these brakes were also created to prevent the trains from falling off the broken railroad.
↑ ↑ ↑ Hope this helps! :D