finally managed to handle paths correctly