Fix hacky pane creation code