Need to fix issues with null pointers