fix rail bug