Your fix should work fine, but the API docs are lying about the return type. Let's cast $success to bool: 
`$success = (bool) delete_data..`