Fixing issue where modal would stop working