Fix problem in custom tostring function