check for empty string before redirecting