Adding better support for error logging and 404 instead of 500