Only enables buttons for a session if it is being displayed

This is a re-application of an earlier fix that seems to have been overwritten in this branch.