Misc fixes

This includes fixes from #99 as well as fixes for affix.js and a solution for #73