added null pointer checks to path setup functions