Improve how stats are calculated

While at it make some headway on always displaying buttons. They disappear
sometimes when clicking the Composite/ChannelI button.
Fix memory leak issues and display bugs