fixed directory parsing issue by moving to os.path.join