properly get basename