Bug fix in toString method