fixing null dom bug