adding null checking