fixed some string copy bugs