fixing bug in calculating base path