fix basename function