Fixing a null exception