Empty string handling fixes