fix overlays for files and pages

This fixes #49 and #68 probably too. @may could you check?