Confirmed that it is a bug. The '/' only need to be added in else clause in the above code. I updated the download package with the fix, you can login, access to My Downloads menu item, download latest version, upgrade it to your site and the error will be gone
Tuan