javascript race condition, move to global home.js