added condition for empty string in url