fixed bug when dealing with size 0 input strings