Fixed incorrect syntax for using basename which caused newline side effects