fix js and templates, the random sql element picker is still broken