added null checking for value passed to mapper