Add safe toString method