Fixed bug on path finding