Fix basename invocation so it works with older versions of coreutils