Fixed problem with rendering notFound outside of the layout.

For #245