diff --git a/public/static/js/geolocation.js b/public/static/js/geolocation.js
index 1c30145..26ca349 100644
--- a/public/static/js/geolocation.js
+++ b/public/static/js/geolocation.js
@@ -51,7 +51,7 @@ $(document).ready(function() {
hafas = candidate.hafas,
distance = candidate.distance.toFixed(1);
- const node = $('' + (parts[2] == 0 ? 'train' : 'directions') + '' + name + '');
+ const node = $('' + (hafas == '0' ? 'train' : 'directions') + '' + name + '');
node.click(function() {
$('nav .preloader-wrapper').addClass('active');
});