Fix javascript loading order