Use getattr instead of __dict__

Change-Id: I72d20c5ec0f1359ff2c92ebed884d6996bb7180a
Use os.path instead of creating the path with +

Change-Id: I785584a5b8031fbec5cbc9a6a798b8fdf9a8c7f3