Fixes for unref and adding panels.