fix null checking