[Improvement] fixing possible nullpointer