fixing null checking