added null check in toString