added extra check for empty string