Check if objects exists before (fix error 500 instead of  404)