Epub Fixes

Applied some changes from @sandersk from Atlas to help fix the epub issues.