reorder js loading sequence, try to fix issue #293