fixing a null exception