Update table to active 0 when there is a new active one. Also added "stupid" isset check. Fixes #1