fix for dirname problem in terminal