Fix navigation to be a real middleware