another optimization to isPathBlocked