Multiple fixes

	* Fixed authentication on middleware
	* Fixed return of errors with render