added null check in mapper method