utils: preventing null pointer exception