Added fixes for modal behavior (according to JUI)
Fixes #188