Fix mg.onerror returns non-zero to stop processing