corrected basename variable to always only ouput basename without extension