Fix bug where rendering fails if called before DOM elements are correctly sized.