Fix problem with modal positioning on narrow screens

Fixes #302