Fix modal so that it reliably works on all plattforms