fix hang on empty string