fixed null checking