Bug fixes and optimizations in admin.js