Fixed exception handling when resource is not found