Fixed logic in localhost check.