Fixed optimize null checks