Fix bugs

Bugs that didn't appear when throwing together this module
with very minimal html