added 404 handling when a resource can not be found