trim string before checking for empty