fixing up error handling when resource not found error sent back