Fixed an embarrassingly bad bug in modal activation/deactivation.