fixed a small bug in string method