Fixing null checks