Fixed basename undefined error