Railway company agrees to new safety measures following derailment