modify app.js so that it works with load history mode