empty string doesn't crash the algorithm anymore