voiding main and gallery re-opening by extending instead of instanceof