Fixing null pointers