Modal Box Autowidth Fix

When a fixed-width dialog was opened before an auto-width dialog, the width of the previous dialog was used. Fixed by adapting width code to height calculation.