put safePath() into common.py so it can be used when needed