vivien's fix for the dispatchEvent permission bug