Fix raillike bug (currently manifests itself on Android), and minor improvement to readability.

NB: Minor edits to patch made by Zeno- (int to short and minor formatting)