Finalized bug fix in toString method