removing empty characters in detection