Fix for modal in modal error: "Uncaught RangeError: Maximum call stack size exceeded".