Various fixes in the js for multi-backend

I think this makes more sense in the application file itself instead of putting it into a specific barclamp.