fixed some string handling errors