Fixes jQuery UI Accordion problems. Also fixes issue #251 (metadata modals).

Linking this to #251.