Fix railties warnings

While investigating #13485 I've squashed those few annoying warnings.