diff --git a/src/ShortestPath/Transit/TransitShortestPathPrecompute.cpp b/src/ShortestPath/Transit/TransitShortestPathPrecompute.cpp
index d4936f3e63bfaab719371d2225332f309dd40323..1eaffdae06c951168dabbafd747999e07b11940e 100644
--- a/src/ShortestPath/Transit/TransitShortestPathPrecompute.cpp
+++ b/src/ShortestPath/Transit/TransitShortestPathPrecompute.cpp
@@ -33,8 +33,8 @@ TransitStateContainer TransitShortestPathPrecompute::executeAlgorithm(const Grap
                 //If there is a proper next node and if it's not the same as our last used line stop predecessor
                 if(nextNode != -1 && (currentState.getConnections().empty() || nextNode != currentState.getConnections().back().getPrecedingNodeIndex())) {
                     TransitAlgorithmState newState; //define variable before conditionals
-                    if(currentState.getConnections().empty() || currentState.getConnections().back().getLineRef() != lineStop.getLineRef()
-                    && currentState.getConnections().size() < 2) // if new line is different than current line
+                    if(currentState.getConnections().empty() || (currentState.getConnections().back().getLineRef() != lineStop.getLineRef()
+                    && currentState.getConnections().size() < 2)) // if new line is different than current line
                     {
                         newState = TransitAlgorithmState(currentState, lineStop);
                         newState.setNodeIndex(nextNode);