Fixed better check for redirecting to the same page