Fixing null references