Fix the calculation of rail size.
Merge pull request #773 from romanbsd/rail-size

Fix the calculation of rail size.