Fix most issues in #357. There is a CSS issue
which occurs on error after calling render
that we should fix seperately