Improve empty origin handling